package cn.wolfcode.crm.service.imp;

import cn.wolfcode.crm.domain.Employee;
import cn.wolfcode.crm.domain.GiftBill;
import cn.wolfcode.crm.domain.MemberInfo;
import cn.wolfcode.crm.mapper.GiftBillMapper;
import cn.wolfcode.crm.mapper.MemberInfoMapper;
import cn.wolfcode.crm.qo.GiftBillQueryObject;
import cn.wolfcode.crm.qo.GiftQueryObject;
import cn.wolfcode.crm.qo.PageResult;
import cn.wolfcode.crm.service.IGiftBillService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
import java.util.List;

@Service
public class GiftBillServiceImpl implements IGiftBillService {
    @Autowired
    private GiftBillMapper giftBillMapper;

    @Override
    public List<GiftBill> selectAll() {
        return giftBillMapper.selectAll();
    }

    @Override
    public PageResult queryByMemberId(GiftBillQueryObject qo) {
        int count = giftBillMapper.rows(qo);
        if (count == 0) {
            return new PageResult(0, Collections.EMPTY_LIST);
        }
        List<?> list = giftBillMapper.queryByMemberId(qo);
        return new PageResult(count,list);
    }

    @Override
    public PageResult query(GiftBillQueryObject qo) {
        int count = giftBillMapper.rows(qo);
        if (count == 0) {
            return new PageResult(0, Collections.EMPTY_LIST);
        }
        List<?> list = giftBillMapper.queryForList(qo);
        return new PageResult(count,list);
    }
}
